
// chon loai thuc vat de xem thong tin
$(document).ready(function() {
	$('#selectedLoaiTV .thucvatLoai').remove();
	
    $('#selectLoaiTV .thucvatLoai').live('click', function () { 
        $(this).appendTo("#selectedLoaiTV");
    });

    $('#selectedLoaiTV .thucvatLoai').live('click', function () { 
        $(this).appendTo("#selectLoaiTV");
    });
});

//chon loai dong vat de xem thong tin
$(document).ready(function() {
	$('#selectedLoaiDV .dongvatLoai').remove();
	
    $('#selectLoaiDV .dongvatLoai').live('click', function () { 
        $(this).appendTo("#selectedLoaiDV");
    });

    $('#selectedLoaiDV .dongvatLoai').live('click', function () { 
        $(this).appendTo("#selectLoaiDV");
    });
});

var oTable =null;

//--------------------------------Phan quan ly thong ke thuc vat------------------------------------------------
function viewAllThucVat(){
	$.ajax({
		type : "POST",
		url : "/CuLaoCham/getData.do",
		data: {name: "datatableThucVat"},
		cache : false,
		dataType : "json",
		success : function(dataTable) {
			setInfoDatatableTV(dataTable);
	},
	error : function(e) {
		alert('Error ' + e);
	}
	});
	$("#thucVatDialog").dialog("open");
}

function setInfoDatatableTV(dataTable){
	if(oTable!=null) oTable.fnDestroy();
	oTable = $("#thucVatList").dataTable({
		"sDom": 'T<"clear">lfrtip',
		"aoColumns": [
		              { "sWidth": "5%" },
		              { "sWidth": "10%" },
		              { "sWidth": "10%" },
		              { "sWidth": "7%" },
		              { "sWidth": "10%" },
		              { "sWidth": "7%" },
		              { "sWidth": "7%" },
		              { "sWidth": "15%" },
		              { "sWidth": "5%" },
		              { "sWidth": "45%" },
		              { "sWidth": "9%" },
		          ],
         "aaData": dataTable["datatableThucVat"], // them du lieu vao cho datatable
         "oTableTools": {
             "aButtons": [
                 {
                     "sExtends":    "xls",
                     "sButtonText": "Excel"
                 },
                 {
                     "sExtends":    "pdf",
                     "sButtonText": "PDF"
                 },
                 {
                     "sExtends":    "print",
                     "sButtonText": "Print"
                 }
             ]
         },
         "bSort": false
	});
}




















